package com.gongzhiyun.springboot3test.exception;

import com.gongzhiyun.springboot3test.base.R;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = false)
public class AppException extends RuntimeException {
    private Integer code = R.ERROR_CODE;
    private String token;

    public AppException(String message) {
        super(message);
    }


    public AppException(Integer code, String message) {
        super(message);
        this.code = code;
    }

    public static AppException getInstance(String message) {
        return AppException.getInstance(R.ERROR_CODE, message);
    }

    public static AppException getInstance(int code, String message) {
        return new AppException(code, message);
    }


}
